package me.send.data.service.provider;

import java.util.Map;

import me.send.business.base.Pager;

public class ActivityProvider {
    
    public String list(Map<String, Object> param) {
    	String sql = "select * from activity_fund_pool_log where 1=1 ";
    	if (param != null) {
    		String fundCode = (String) param.get("fundCode");
    		Integer activityType = (Integer) param.get("activityType");
    		String start=(String) param.get("start");
    		String end=(String) param.get("end");
    		Pager page=(Pager) param.get("page");
    		if (fundCode!=null&&!fundCode.equals("")) {
    			sql += " and fundCode=" + fundCode;
    		}
    		if (activityType!=null&&activityType >= 0) {
    			sql += " and activityType=" + activityType;
    		}
    		if(start!=null&&!start.equals("")){
    			sql+=" and createTime>='"+start+"'";
    		}
    		if(end!=null&&!end.equals("")){
    			sql+=" and createTime<'"+end+"'";
    		}
    		sql += " limit " + page.getStart() + "," + page.getRows();
    	}
    	return sql;
    }
    public String list_pool(Map<String, Object> param) {
    	String sql = "select * from activity_fund_pool where 1=1 ";
    	if (param != null) {
    		String fundCode = (String) param.get("fundCode");
    		Integer status = (Integer) param.get("status");
    		String start=(String) param.get("start");
    		String end=(String) param.get("end");
    		Pager page=(Pager) param.get("page");
    		if (fundCode!=null&&!fundCode.equals("")) {
    			sql += " and fundCode=" + fundCode;
    		}
    		if (status!=null&&status >= 0) {
    			sql += " and status=" + status;
    		}
    		if(start!=null&&!start.equals("")){
    			sql+=" and createTime>='"+start+"'";
    		}
    		if(end!=null&&!end.equals("")){
    			sql+=" and createTime<'"+end+"'";
    		}
    		sql += " limit " + page.getStart() + "," + page.getRows();
    	}
    	return sql;
    }
    public String count_pool(Map<String, Object> param) {
    	String sql = "select count(1) from activity_fund_pool where 1=1 ";
    	if (param != null) {
    		String fundCode = (String) param.get("fundCode");
    		Integer status = (Integer) param.get("status");
    		String start=(String) param.get("start");
    		String end=(String) param.get("end");
    		if (fundCode!=null&&!fundCode.equals("")) {
    			sql += " and fundCode=" + fundCode;
    		}
    		if (status!=null&&status >= 0) {
    			sql += " and status=" + status;
    		}
    		if(start!=null&&!start.equals("")){
    			sql+=" and createTime>='"+start+"'";
    		}
    		if(end!=null&&!end.equals("")){
    			sql+=" and createTime<'"+end+"'";
    		}
    	}
    	return sql;
    }
    public String count(Map<String, Object> param) {
    	String sql = "select count(1) from activity_fund_pool_log where 1=1 ";
    	if (param != null) {
    		String fundCode = (String) param.get("fundCode");
    		Integer activityType = (Integer) param.get("activityType");
    		String start=(String) param.get("start");
    		String end=(String) param.get("end");
    		if (fundCode!=null&&!fundCode.equals("")) {
    			sql += " and fundCode=" + fundCode;
    		}
    		if (activityType!=null&&activityType >= 0) {
    			sql += " and activityType=" + activityType;
    		}
    		if(start!=null&&!start.equals("")){
    			sql+=" and createTime>='"+start+"'";
    		}
    		if(end!=null&&!end.equals("")){
    			sql+=" and createTime<'"+end+"'";
    		}
    	}
    	return sql;
    }
   
    
    
}
